/*
 *  Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */

/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */
#include "mcrouter/lib/carbon/example/gen/HelloGoodbyeMessages.h"

#include "mcrouter/lib/carbon/example/gen/gen-cpp2/HelloGoodbye_types.h"

namespace hellogoodbye {
namespace thrift {

void HelloRequest::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(key_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(shardId_ref(), fieldType);
        break;
      }
      case 3: {
        reader.readField(deadlineMs_ref(), fieldType);
        break;
      }
      case 4: {
        reader.readField(message_ref(), fieldType);
        break;
      }
      case 5: {
        reader.readField(priority_ref(), fieldType);
        break;
      }
      case 6: {
        reader.readField(beforeLatencyUs_ref(), fieldType);
        break;
      }
      case 7: {
        reader.readField(afterLatencyUs_ref(), fieldType);
        break;
      }
      case 8: {
        reader.readField(clientVersion_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void HelloReply::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(result_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(message_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void GoodbyeRequest::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(key_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(shardId_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}

void GoodbyeReply::deserialize(carbon::CarbonProtocolReader& reader) {
  reader.readStructBegin();
  while (true) {
    const auto pr = reader.readFieldHeader();
    const auto fieldType = pr.first;
    const auto fieldId = pr.second;

    if (fieldType == carbon::FieldType::Stop) {
      break;
    }

    switch (fieldId) {
      case 1: {
        reader.readField(result_ref(), fieldType);
        break;
      }
      case 2: {
        reader.readField(message_ref(), fieldType);
        break;
      }
      default: {
        reader.skip(fieldType);
        break;
      }
    }
  }
  reader.readStructEnd();
}
} // namespace thrift
} // namespace hellogoodbye
